package net.liteheaven.xblib.common.ui;

import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;

/**
 * Created by LiangYu on 16/8/29
 */
public class ViewHelper {

    /**
     * 设置背景的兼容版本
     * @param view
     * @param drawable
     */
    public static void setBackgroundCompat(View view, Drawable drawable){
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            view.setBackground(drawable);
        }else{
            view.setBackgroundDrawable(drawable);
        }
    }
}
